<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <ul>
        <!--循环数组-->
        <li v-for="(item,index) in names" :key="index">{{index}}--{{item}}</li>
    </ul>
    <ul>
        <!--循环数组对象-->
        <li v-for="(item,index) in persons" :key="item.id">{{item.id}}--{{item.name}}--{{item.age}}--{{index}}</li>
    </ul>
</div>
<script src="../../JavaScript/vue.js"></script>
<script>
    /*
        v-for指令：基于原始数据多次渲染元素或模板块。
        期望的绑定值类型：Array | Object | number | string | Iterable
        指令值必须使用特殊语法 alias in expression 为正在迭代的元素提供一个别名
    */
    const app = Vue.createApp({
        data() {
            return {
                names: ["马云", "马化腾", "马宝国", "马斯克"],
                persons: [
                    {id: 1, name: "陶品奇", age: 22},
                    {id: 2, name: "陶渊明", age: 102}
                ]
            }
        }
    })
    app.mount("#app")
</script>
</body>
</html>